using System;
using System.Collections.Generic;
using System.Xml;
using System.Data;
using System.Data.SqlClient;

namespace AIFSDataAccessLayer
{
    /// <summary>
    /// Interface defines functionality required to perform a data access operation.
    /// There are two implementations of this executor. One for transaction aware tasks another for transaction unaware tasks.
    /// </summary>
    /// <seealso cref="SimpleExecutionContext"/>
    /// <seealso cref="TransactionExecutionContext"/>
    public interface IDataExecutionContext : IDisposable
    {
        int ExecuteNonQuery(DalSqlCommand cmd);
        object ExecuteScalar(DalSqlCommand cmd);
        SqlDataAdapter ExecuteDataAdapter(DalSqlCommand cmd);
        DataTable ExecuteDataTable(DalSqlCommand cmd);
        DataSet ExecuteDataSet(DalSqlCommand cmd);
        SqlDataReader ExecuteDataReader(DalSqlCommand cmd);

        /// <summary>
        /// Method is implemented to return an XML reader
        /// </summary>
        /// <remarks>Caller should explicitly close the connection for non transactional excution context.</remarks>
        XmlReader ExecuteXmlReader(DalSqlCommand cmd);

        DalSqlCommand CreateCommand();
        DalSqlCommand CreateStoredProcCommand(string storedProcName);
        DalSqlCommand CreateTextCommand(string commandText);
        DalSqlCommand CreateTextCommand(string commandFormatString, params object[] args);

        IConnectionProvider ConnectionProvider { get;}
    }
}
